package com.xingyun.kingdee.erp.service.common.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @file: com.xingyun.xybb.helper.util.common.constant.ErpUrlConstants
 * @Description: erp网址常量
 * @author lingo
 * @version v1.0
 * @date 2019/11/15 10:01
 * @Company www.xyb2b.com
 */
@Component
public class ErpUrlConstants {
    private static Logger logger = LoggerFactory.getLogger(ErpUrlConstants.class);

    private static String baseIp;
    public static String loginUrl;
    public static String viewListUrl;
    public static String viewFormUrl;
    public static String saveFormUrl;
    public static String batchSaveFormUrl;
    public static String saveDarftFormUrl;
    public static String submitFormUrl;
    public static String auditFormUrl;
    public static String pushDownUrl;
    public static String unAuditUrl;
    public static String delUrl;

    @Value("${erp.ip:http://erp.xyb2b.com/}")
    private void setBaseIp(String ip){
        baseIp = ip;
        logger.info("Erp的访问地址设置为 {}",baseIp);
    }

    @PostConstruct
    private void init(){
        String baseApiUrl = baseIp + "K3Cloud/Kingdee.BOS.WebApi.ServicesStub.";
        loginUrl = baseApiUrl + "AuthService.ValidateUser.common.kdsvc";
        viewListUrl = baseApiUrl + "DynamicFormService.ExecuteBillQuery.common.kdsvc";
        viewFormUrl = baseApiUrl + "DynamicFormService.View.common.kdsvc";
        saveFormUrl = baseApiUrl + "DynamicFormService.Save.common.kdsvc";
        batchSaveFormUrl = baseApiUrl + "DynamicFormService.BatchSave.common.kdsvc";
        saveDarftFormUrl = baseApiUrl + "DynamicFormService.Draft.common.kdsvc";
        submitFormUrl = baseApiUrl + "DynamicFormService.Submit.common.kdsvc";
        auditFormUrl = baseApiUrl + "DynamicFormService.Audit.common.kdsvc";
        pushDownUrl = baseApiUrl + "DynamicFormService.Push.common.kdsvc";
        unAuditUrl = baseApiUrl + "DynamicFormService.UnAudit.common.kdsvc";
        delUrl = baseApiUrl + "DynamicFormService.Delete.common.kdsvc";
    }
}